package org.example.sentinel.config;

import com.alibaba.csp.sentinel.slots.block.BlockException;

/**
 * @author tds
 * @version 1.0.0
 * @Company
 * @ClassName SentinelExceptionHandler
 * @Description 触发sentinel规则的处理
 * @Date 2023-04-24 20:05
 */
public class SentinelExceptionHandler {

    public static String fallbackMethod(Throwable ex) {
        ex.printStackTrace();
        System.out.println("errormessage:" + ex.getMessage());
        return "fallback";
    }

    public static String blockHandler(BlockException blockException) {
        System.out.println("blockHandler:" + blockException.getRule());
        return "blockHandler";
    }


}
